package com.ease.context.ioc;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;

import org.springframework.core.io.Resource;

/**
 * 
 * @author nathanleewei
 * 
 */
public class DynamicResource implements Resource {

	private AbstractDynamicBean dynamicBean;

	public DynamicResource(AbstractDynamicBean dynamicBean) {
		this.dynamicBean = dynamicBean;
	}

	public InputStream getInputStream() throws IOException {
		return new ByteArrayInputStream(dynamicBean.getXml().getBytes("UTF-8"));
	}

	public boolean exists() {

		return false;
	}

	public boolean isReadable() {

		return false;
	}

	public boolean isOpen() {

		return false;
	}

	public URL getURL() throws IOException {

		return null;
	}

	public URI getURI() throws IOException {

		return null;
	}

	public File getFile() throws IOException {

		return null;
	}

	public long lastModified() throws IOException {

		return 0;
	}

	public Resource createRelative(String relativePath) throws IOException {

		return null;
	}

	public String getFilename() {

		return null;
	}

	public String getDescription() {

		return null;
	}
}
